package com.ruangong.GitClient.Test.YanZhaoWangTest;

import android.annotation.SuppressLint;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Type;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.util.Map;

public class Test2 {
    public static void main(String[] args) throws IOException {
        Gson gson = new Gson();
//        FileReader fileReader=new FileReader("app/src/main/java/com/ruangong/GitClient/YanZhaoWang/Province_University.json");
//        Type mapType = new TypeToken<Map<String, Object>>(){}.getType();
//        Map<String, Object> jsonMap = gson.fromJson(fileReader, mapType);
//        System.out.println(jsonMap);
//        String json=gson.fromJson(fileReader, mapType);
//        String json=Files.readString(Paths.get("path/to/your/file.txt"));
        @SuppressLint({"NewApi", "LocalSuppress"}) String json = new String(Files.readAllBytes(Paths.get("app/src/main/java/com/ruangong/GitClient/YanZhaoWang/Province_University.json")));
//        System.out.println(json);
//        JsonElement jsonElement= JsonParser.parseString(json);
//        System.out.println(jsonElement);
        JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject();

        System.out.println(jsonObject.get("zone"));
        System.out.println(jsonObject.get("university"));


    }
}
